<template>
  <a class="show-item" target="_blank" v-bind:href="'#/content/'+item.id" v-bind:title="item.title">
    <Card class="show-card">
      <div class="row-wrapper">
        <div class="show-poster">
          <img class="poster" :src="imageBase">
          <!--<div class="discount">
                      <div class="ie9-discount-bg">
                      8.
                      <span class="small-number">0</span>
                      <div class="unit">折起</div>
                      </div>
                  </div> -->
        </div>
        <div class="show-info">
          <div class="show-name" title="">{{item.title}}</div>
          <div class="show-desc">{{item.shortDesc}}</div>
          <mtag class="tag" tagv="售票中"></mtag>
          <div class="row-wrapper bottom-align">
            <div class="show-time">{{item.beginOn}}</div>
            <div class="show-addr">{{item.place}}</div>
            <div class="show-price">
              {{item.minPrice}}
              <span class="price-unit">元起</span>
              <!--<span class="fr"><i class="icon-c icon-c-list-favourite"></i></span>-->
            </div>
          </div>
        </div>
      </div>
      <div class="bottom-info">
        <div class="info-one">
          <Icon type="eye" size="18"></Icon>
          <span>6930人浏览</span>
        </div>
        <div class="info-one">
          <Icon type="ios-heart" size="15"></Icon>
          <span>177人想看</span>
        </div>
      </div>
    </Card>
  </a>
</template>

<style lang="css" scoped>
  .show-card {
    width: 400px;
    margin: 20px 20px;
  }

  .show-poster {
    display: inline-block;
  }

  .poster {
    margin: -35px 0px 0px -30px;
    width: 140px;
    height: 200px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 4px 16px 0 #aaa;
  }

  .show-info {
    float: right;
    width: 220px;
    top: 10px;
    right: 20px;
    bottom: 7px;
    position: absolute;
  }

  .show-name {
    font-size: 16px;
    color: #331612;
    line-height: 24px;
    height: 46px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
  }

  .show-desc {
    font-size: 12px;
    color: #aaa;
    padding: 5px 0;
    line-height: 16px;
  }

  .tags {
    position: absolute;
    bottom: 64px;
  }

  .bottom-align {
    position: absolute;
    margin-top: 10px;
    bottom: 5px;
  }

  .row-wrapper {
    display: inline-block;
    width: 100%;
    position: relative;
  }

  .show-time {
    font-size: 12px;
    color: #494949;
    line-height: 20px;
    width: 150px;
  }

  .show-addr {
    font-size: 12px;
    color: #494949;
    line-height: 20px;
    float: left;
    width: 150px;
  }

  .show-price {
    font-size: 20px;
    color: #fd6857;
    float: right;
    font-weight: 600;
  }

  .price-unit {
    font-size: 12px;
    font-weight: 400;
    margin-left: 5px;
  }

  .bottom-info {
    margin: 10px 20px 0 20px;
    border-top: solid 1px #efefef;
    padding-top: 10px;
  }

  .bottom-info .info-one {
    display: inline-block;
    margin-right: 20px;
    color: #999;
    font-size: 12px;
  }
</style>

<script>
  import mtag from "./mtag";

  export default {
    props: ["item"],
    components: {
      mtag
    },
    data() {
      return {
        imageBase: '',
      };
    },
    methods: {
      loadImage() {
        this.$axios({
          method: 'get',
          url: `/api/image/${this.item.poster}`,
        }).then(res => {
          this.imageBase = res.data.imageBase;
        });
      }
    },
    mounted() {
      this.loadImage();
    },
    updated() {
      this.loadImage();
    }
  };
</script>
